home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / h / catalog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-30  |  4.1 KB  |  152 lines

  1. #
  2. /*
  3. **  CATALOG.H -- system catalog definitions
  4. **
  5. **    relation and attribute catalogs are defined in ingres.h.
  6. **
  7. **    Version:
  8. **        @(#)catalog.h    8.2    5/30/88
  9. */
  10.  
  11.  
  12.  
  13. /*
  14. **    INDEX relation struct
  15. **
  16. **    The INDEX relation is used to determine what, if any,
  17. **    secondary indicies exist for relations.  If a relation
  18. **    has a secondary index, there will be one tuple in the
  19. **    INDEX relation for each such index.  There may be one
  20. **    or more domains indexed by one or many INDEX relations
  21. **    depending on whether single or combined indicies are
  22. **    being used.
  23. **
  24. **    Combined indices may use up to six domains to form the
  25. **    index.
  26. **
  27. **    The simple existance of a secondary index is better
  28. **    checked using the "relindxd" field in the RELATION
  29. **    relation, since that is more efficient.
  30. **
  31. **    The two values SECINDEX and SECBASE are the values for
  32. **    the relindxd field of the relation relation.  Implicitly
  33. **    SECINDEX must be < 0 and SECBASE must be > 0.
  34. */
  35.  
  36. # define    IRELIDP        1
  37. # define    IOWNERP        2
  38. # define    IRELIDI        3
  39.  
  40. # define    SECINDEX    -2    /* this value in rel.relindxd indicates
  41.                     ** that the relation is a sec. index */
  42. # define    SECBASE        1    /* this value in rel.relindxd indicates
  43.                     ** has a sec. index */
  44. # define    ORDERED        3    /* this value in rel.relindxd in 
  45.                     ** absolute value indicates that the 
  46.                     ** relation is ordered, if >0 also 
  47.                     ** indexed */
  48.  
  49. struct index
  50. {
  51.     char    irelidp[MAXNAME];    /*unique name of primary relation    */
  52.     char    iownerp[2];        /*owner of primary relation*/
  53.     char    irelidi[MAXNAME];    /*unique name of index relation    */
  54.     char    irelspeci;        /*relspec of index relation*/
  55.     char    idom[MAXKEYS];        /* domain number of primary relation */
  56.                     /* which corresponds to each index attribute */
  57.                     /* In the indexes relation these are stored as */
  58.                     /* idom1, idom2, ..,idom6 */
  59. };
  60.  
  61.  
  62.  
  63. /*
  64. **  TREE RELATION STRUCT
  65. **
  66. **    The TREE relation stores trees used by query modification and
  67. **    for distribution criteria.
  68. */
  69.  
  70. struct tree
  71. {
  72.     char    treerelid[MAXNAME];    /* relation name */
  73.     char    treeowner[2];        /* relation owner */
  74.     short    treeid;            /* internal name of this tuple */
  75.     short    treeseq;        /* sequence number in tree */
  76.     char    treetype;        /* type info for this tree */
  77.     char    treexxxx;
  78.     char    treetree[100];        /* contents of tree */
  79. };
  80.  
  81. # define    TREERELID    1
  82. # define    TREEOWNER    2
  83. # define    TREEID        3
  84. # define    TREESEQ        4
  85. # define    TREETYPE    5
  86.  
  87.  
  88.  
  89. /*
  90. **  STRUCT PROTECT -- protection catalog
  91. **
  92. **    This structure defines the format of the 'protect' catalog.
  93. **    One or two things should be noted.  First, the 'prodomset'
  94. **    field is actually four domains in the physical relation,
  95. **    since the best we know about is i4's, and we need an i16.
  96. **    Second, both the proopset and the prodomset fields
  97. **    are bit maps.
  98. */
  99.  
  100. struct protect
  101. {
  102.     char    prorelid[MAXNAME];    /* relation to which this applies */
  103.     char    prorelown[2];        /* owner */
  104.     short    propermid;        /* permission sequence number */
  105.     char    prouser[2];        /* user code in PERMIT */
  106.     char    proterm[8];        /* terminal in PERMIT */
  107.     char    proresvar;        /* Resultvarno in tree */
  108.     char    proopset;        /* operation set */
  109.     short    protodbgn;        /* beginning time of day */
  110.     short    protodend;        /* ending time of day */
  111.     char    prodowbgn;        /* beginning day of week */
  112.     char    prodowend;        /* ending day of week */
  113. #ifndef    VAX
  114.     short    fill;
  115. #endif
  116.     short    prodomset[8];        /* domain set permitted */
  117.     short    protree;        /* link to qualification */
  118. };
  119.  
  120. /* field numbers for find() calls */
  121. # define    PRORELID    1
  122. # define    PRORELOWN    2
  123. # define    PROPERMID    3
  124. # define    PROTREE        16
  125.  
  126. /* bit values for proopset */
  127. # define    PRO_RETR    0001    /* retrieve */
  128. # define    PRO_REPL    0002    /* replace */
  129. # define    PRO_DEL        0004    /* delete */
  130. # define    PRO_APP        0010    /* append */
  131. # define    PRO_TEST    0020    /* test in qualification */
  132. # define    PRO_AGGR    0040    /* retrieve aggregate value */
  133.  
  134.  
  135.  
  136. /*
  137. **  STRUCT INTEGRITY -- the descriptor for the integrity relation
  138. */
  139.  
  140. struct integrity
  141. {
  142.     char    intrelid[MAXNAME];    /* name of the relation */
  143.     char    intrelowner[2];        /* owner of the relation */
  144.     short    inttree;        /* pointer into the tree catalog */
  145.     short    intdomset[8];        /* set of domains this applies to */
  146.     char    intresvar;        /* primary variable number */
  147. };
  148.  
  149. # define    INTRELID    1
  150. # define    INTRELOWNER    2
  151. # define    INTTREE        3
  152.